<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Linux配置 | lilei</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/images/icons/logo.png">
    <link rel="apple-touch-icon" href="/images/icons/logo.png">
    <link rel="manifest" href="/manifest.json">
    <script type="text/javascript" src="/assets/js/load.js"></script>
    <meta name="description" content="个人网站">
    <meta name="twitter:title" content="Linux配置">
    <meta name="twitter:description" content="">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:url" content="http://www.lileiblog.xyz/System/Linux%E9%85%8D%E7%BD%AE.html">
    <meta property="og:type" content="article">
    <meta property="og:title" content="Linux配置">
    <meta property="og:description" content="">
    <meta property="og:url" content="http://www.lileiblog.xyz/System/Linux%E9%85%8D%E7%BD%AE.html">
    <meta property="og:site_name" content="lilei">
    <meta itemprop="name" content="Linux配置">
    <meta itemprop="description" content="">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/images/icons/logo.png">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="keywords" content="lilei,vue,vuepress,vuepress-theme,theme,主题,vuepress主题,blog
        ,vuepress-blog,java,python,shell,sql,golang,script,shell script,nginx,windows,去广告,androd,google drive
        ,one drive,idea,eclipse,git,小程序">
    <meta name="referrer" content="never">
    
    <link rel="preload" href="/assets/css/0.styles.8932179b.css" as="style"><link rel="preload" href="/assets/js/app.269009d6.js" as="script"><link rel="preload" href="/assets/js/3.974b9720.js" as="script"><link rel="preload" href="/assets/js/68.fa59daa9.js" as="script"><link rel="prefetch" href="/assets/js/10.5915e99b.js"><link rel="prefetch" href="/assets/js/11.ff732762.js"><link rel="prefetch" href="/assets/js/12.8bb86d91.js"><link rel="prefetch" href="/assets/js/13.18bde5b0.js"><link rel="prefetch" href="/assets/js/14.314fae34.js"><link rel="prefetch" href="/assets/js/15.0a4ff48f.js"><link rel="prefetch" href="/assets/js/16.ffaf1503.js"><link rel="prefetch" href="/assets/js/17.49a31a6e.js"><link rel="prefetch" href="/assets/js/18.7e6443bf.js"><link rel="prefetch" href="/assets/js/19.6880cc9a.js"><link rel="prefetch" href="/assets/js/20.1fb3f255.js"><link rel="prefetch" href="/assets/js/21.0cd39eea.js"><link rel="prefetch" href="/assets/js/22.392d85cb.js"><link rel="prefetch" href="/assets/js/23.f50adb15.js"><link rel="prefetch" href="/assets/js/24.43e324e1.js"><link rel="prefetch" href="/assets/js/25.e3663205.js"><link rel="prefetch" href="/assets/js/26.da141fb8.js"><link rel="prefetch" href="/assets/js/27.6c05235a.js"><link rel="prefetch" href="/assets/js/28.c124245a.js"><link rel="prefetch" href="/assets/js/29.d185870d.js"><link rel="prefetch" href="/assets/js/30.8587d422.js"><link rel="prefetch" href="/assets/js/31.dc382b56.js"><link rel="prefetch" href="/assets/js/32.20ba32e9.js"><link rel="prefetch" href="/assets/js/33.6ecd7de9.js"><link rel="prefetch" href="/assets/js/34.2b91c13a.js"><link rel="prefetch" href="/assets/js/35.66ed0733.js"><link rel="prefetch" href="/assets/js/36.ce7bca84.js"><link rel="prefetch" href="/assets/js/37.d00bb5ac.js"><link rel="prefetch" href="/assets/js/38.c3ecbb6f.js"><link rel="prefetch" href="/assets/js/39.308f4175.js"><link rel="prefetch" href="/assets/js/4.520f6ecc.js"><link rel="prefetch" href="/assets/js/40.f4b98bc2.js"><link rel="prefetch" href="/assets/js/41.95fae64f.js"><link rel="prefetch" href="/assets/js/42.fe4f877b.js"><link rel="prefetch" href="/assets/js/43.ca8f222e.js"><link rel="prefetch" href="/assets/js/44.4d4ee79e.js"><link rel="prefetch" href="/assets/js/45.79178b33.js"><link rel="prefetch" href="/assets/js/46.c3817d0b.js"><link rel="prefetch" href="/assets/js/47.b8252443.js"><link rel="prefetch" href="/assets/js/48.df9d5d3b.js"><link rel="prefetch" href="/assets/js/49.d812fdb2.js"><link rel="prefetch" href="/assets/js/5.f1a24a16.js"><link rel="prefetch" href="/assets/js/50.55cfcaa8.js"><link rel="prefetch" href="/assets/js/51.b8608b02.js"><link rel="prefetch" href="/assets/js/52.52c5e00d.js"><link rel="prefetch" href="/assets/js/53.3a9bd5fb.js"><link rel="prefetch" href="/assets/js/54.a4240c13.js"><link rel="prefetch" href="/assets/js/55.01c4b876.js"><link rel="prefetch" href="/assets/js/56.f29549a3.js"><link rel="prefetch" href="/assets/js/57.01438a04.js"><link rel="prefetch" href="/assets/js/58.29bb4626.js"><link rel="prefetch" href="/assets/js/59.e8b89408.js"><link rel="prefetch" href="/assets/js/6.8c478b39.js"><link rel="prefetch" href="/assets/js/60.bedb5381.js"><link rel="prefetch" href="/assets/js/61.bdfbe584.js"><link rel="prefetch" href="/assets/js/62.cb825d1a.js"><link rel="prefetch" href="/assets/js/63.a9516572.js"><link rel="prefetch" href="/assets/js/64.aa854ed7.js"><link rel="prefetch" href="/assets/js/65.285f883d.js"><link rel="prefetch" href="/assets/js/66.12849f37.js"><link rel="prefetch" href="/assets/js/67.c18b00e4.js"><link rel="prefetch" href="/assets/js/69.e9d5dda4.js"><link rel="prefetch" href="/assets/js/7.cfb0d0ea.js"><link rel="prefetch" href="/assets/js/70.db126cce.js"><link rel="prefetch" href="/assets/js/71.6acb04cd.js"><link rel="prefetch" href="/assets/js/72.7ff0ab11.js"><link rel="prefetch" href="/assets/js/73.9a66da79.js"><link rel="prefetch" href="/assets/js/74.0a38a030.js"><link rel="prefetch" href="/assets/js/75.7b32dbb3.js"><link rel="prefetch" href="/assets/js/8.cb9c08e5.js"><link rel="prefetch" href="/assets/js/9.ad652cfe.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.110a1065.js">
    <link rel="stylesheet" href="/assets/css/0.styles.8932179b.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/images/icons/logo.png" alt="lilei" class="logo"> <span class="site-name can-hide">lilei</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link router-link-active">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link router-link-active">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>System</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/System/" aria-current="page" class="sidebar-link">System</a></li><li><a href="/System/CentOS.html" class="sidebar-link">CentOS</a></li><li><a href="/System/Docker.html" class="sidebar-link">Docker</a></li><li><a href="/System/Linux操作.html" class="sidebar-link">Linux操作</a></li><li><a href="/System/Linux配置.html" class="active sidebar-link">Linux配置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/System/Linux配置.html#源码安装卸载软件" class="sidebar-link">源码安装卸载软件</a></li><li class="sidebar-sub-header"><a href="/System/Linux配置.html#初次配置" class="sidebar-link">初次配置</a></li><li class="sidebar-sub-header"><a href="/System/Linux配置.html#开机启动" class="sidebar-link">开机启动</a></li><li class="sidebar-sub-header"><a href="/System/Linux配置.html#修改为root登录" class="sidebar-link">修改为root登录</a></li><li class="sidebar-sub-header"><a href="/System/Linux配置.html#物理资源占用" class="sidebar-link">物理资源占用</a></li></ul></li><li><a href="/System/内网穿透.html" class="sidebar-link">内网穿透</a></li><li><a href="/System/挂载网盘.html" class="sidebar-link">挂载网盘</a></li><li><a href="/System/文件压缩解压.html" class="sidebar-link">文件压缩解压</a></li><li><a href="/System/邮箱.html" class="sidebar-link">邮箱</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="linux配置"><a href="#linux配置" class="header-anchor">#</a> Linux配置</h1> <p></p><div class="table-of-contents"><ul><li><a href="#源码安装卸载软件">源码安装卸载软件</a><ul><li><a href="#checkinstall">checkinstall</a></li></ul></li><li><a href="#初次配置">初次配置</a><ul><li><a href="#修改时区为亚洲上海">修改时区为亚洲上海</a></li><li><a href="#查看系统语言">查看系统语言</a></li><li><a href="#安装简体中文语言包">安装简体中文语言包</a></li><li><a href="#设置中文utf8编码">设置中文utf8编码</a></li><li><a href="#设置vim">设置VIM</a></li><li><a href="#ssh会话执行文件">SSH会话执行文件</a></li><li><a href="#ssh欢迎信息">ssh欢迎信息</a></li></ul></li><li><a href="#开机启动">开机启动</a></li><li><a href="#修改为root登录">修改为root登录</a></li><li><a href="#物理资源占用">物理资源占用</a></li></ul></div><p></p> <h1 id="flag"><a href="#flag" class="header-anchor">#</a> Flag</h1> <ul><li><a href="https://www.kernel.org" target="_blank" rel="noopener noreferrer">https://www.kernel.org<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>各个版本控件支持库 <a href="https://pkgs.org" target="_blank" rel="noopener noreferrer">https://pkgs.org<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>软件包管理器 <a href="https://github.com/NixOS/nix" target="_blank" rel="noopener noreferrer">https://github.com/NixOS/nix<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>编译嵌入式 <a href="https://github.com/buildroot/buildroot" target="_blank" rel="noopener noreferrer">https://github.com/buildroot/buildroot<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>服务器音频播放器 <a href="https://github.com/badaix/snapcast" target="_blank" rel="noopener noreferrer">https://github.com/badaix/snapcast<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>桌面 <a href="https://github.com/kernelslacker/trinity" target="_blank" rel="noopener noreferrer">https://github.com/kernelslacker/trinity<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://kde.org/zh-cn/plasma-desktop" target="_blank" rel="noopener noreferrer">https://kde.org/zh-cn/plasma-desktop<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li><a href="https://github.com/littlekernel/lk" target="_blank" rel="noopener noreferrer">https://github.com/littlekernel/lk<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li><a href="http://yiiyee.cn/blog/2019/08/28/lk1" target="_blank" rel="noopener noreferrer">Little Kernel 代码走读（一） – 易也技术<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/dahliaOS/fimage" target="_blank" rel="noopener noreferrer">https://github.com/dahliaOS/fimage<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://fuchsia.fsf.org.cn" target="_blank" rel="noopener noreferrer">https://fuchsia.fsf.org.cn<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul> <h2 id="源码安装卸载软件"><a href="#源码安装卸载软件" class="header-anchor">#</a> 源码安装卸载软件</h2> <blockquote><p>编译时的路径如果指定了<code>--prefix /usr/local/xxx</code> 直接<code>rm -rf /usr/local/xxx</code>即可。</p> <p>没指定路径，那就到源码路径执行make uninstall，如果最初的编译文件夹被删除了，还可以重新下载、编译，然后删除</p></blockquote> <p><strong>如果源码被删除就查找并删除</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">find</span> / -name 软件名称
</code></pre></div><h3 id="checkinstall"><a href="#checkinstall" class="header-anchor">#</a> checkinstall</h3> <blockquote><p>通过<code>checkinstall</code>管理编译安装过程</p></blockquote> <p><strong>使用<code>checkinstall</code>编译安装</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>./configure
<span class="token function">make</span>
checkinstall
</code></pre></div><ul><li>CheckInstall会完成以下任务</li></ul> <ol><li>调用<code>make install</code>，然后用<code>installwatch</code>监视、记录整个安装过程中添加的文件</li> <li>等到安装完成，把记录的文件打包，根据不同的系统创建安装包：<code>.rpm</code>或<code>.deb</code> <ul><li>注：安装包会保存在源代码目录，以便复制到其它机器安装，省去重复编译的麻烦。</li></ul></li> <li>移除<code>make install</code>安装的文件</li> <li>调用系统安装工具来安装第2步创建的安装包：<code>rpm -i</code>或<code>dpkg -i</code></li></ol> <p><strong>卸载<code>checkinstall</code>安装的软件</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>CentOS: <span class="token function">rpm</span> -e package_name
Ubuntu: dpkg -r package_name
</code></pre></div><h2 id="初次配置"><a href="#初次配置" class="header-anchor">#</a> 初次配置</h2> <h3 id="修改时区为亚洲上海"><a href="#修改时区为亚洲上海" class="header-anchor">#</a> 修改时区为亚洲上海</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">ln</span> -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
</code></pre></div><h3 id="查看系统语言"><a href="#查看系统语言" class="header-anchor">#</a> 查看系统语言</h3> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment">#查看系统当前使用语言包</span>
locale
<span class="token comment">#查看系统拥有语言包</span>
locale -a
</code></pre></div><h3 id="安装简体中文语言包"><a href="#安装简体中文语言包" class="header-anchor">#</a> 安装简体中文语言包</h3> <blockquote><p>如果没有zh_CN.utf8就需要安装简体中文语言包</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code>yum -y <span class="token function">install</span> kde-l10n-Chinese
<span class="token comment">#glibc-common软件包包括用于GNU libc库的常见二进制文件，以及国家语言（locale）支持。</span>
yum -y reinstall glibc-common
yum -y groupinstall chinese-support
</code></pre></div><h3 id="设置中文utf8编码"><a href="#设置中文utf8编码" class="header-anchor">#</a> 设置中文utf8编码</h3> <p><strong>临时</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token builtin class-name">export</span> <span class="token assign-left variable"><span class="token environment constant">LANG</span></span><span class="token operator">=</span>zh_CN.UTF-8
<span class="token builtin class-name">export</span> <span class="token assign-left variable"><span class="token environment constant">LANGUAGE</span></span><span class="token operator">=</span>zh_CN.UTF-8
</code></pre></div><p><strong>长久</strong></p> <ul><li>CenOS7修改<code>vi /etc/locale.conf</code></li> <li>CentOS6修改<code>vi /etc/sysconfig/i18n</code></li> <li>Ubuntu修改<code>vi /etc/default/locale</code> <ul><li><a href="https://blog.csdn.net/qu_learner/article/details/104030765" target="_blank" rel="noopener noreferrer">Ubuntu修改编码格式为中文<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token assign-left variable"><span class="token environment constant">LANG</span></span><span class="token operator">=</span><span class="token string">&quot;zh_CN.utf8&quot;</span>
<span class="token assign-left variable"><span class="token environment constant">LANGUAGE</span></span><span class="token operator">=</span><span class="token string">&quot;zh_CN.UTF-8:zh_CN.utf8:zh_CN&quot;</span>
<span class="token assign-left variable">SUPPORTED</span><span class="token operator">=</span><span class="token string">&quot;zh_CN.utf8:zh_CN:zh:en_US.utf8:en_US:en&quot;</span>
<span class="token assign-left variable">SYSFONT</span><span class="token operator">=</span><span class="token string">&quot;lat0-sun16&quot;</span>
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>localectl set-locale <span class="token assign-left variable"><span class="token environment constant">LANG</span></span><span class="token operator">=</span>zh_CN.utf8
</code></pre></div><h3 id="设置vim"><a href="#设置vim" class="header-anchor">#</a> 设置VIM</h3> <p><strong>解决中文乱码问题</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> /etc/vim/vimrc
<span class="token comment"># 在开头或者末尾添加</span>
<span class="token builtin class-name">set</span> <span class="token assign-left variable">fileencodings</span><span class="token operator">=</span>utf-8,gbk,utf-16le,cp1252,iso-8859-15,ucs-bom
<span class="token builtin class-name">set</span> <span class="token assign-left variable">termencoding</span><span class="token operator">=</span>utf-8
<span class="token builtin class-name">set</span> <span class="token assign-left variable">encoding</span><span class="token operator">=</span>utf-8
</code></pre></div><p><strong>显示行号</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> /etc/vimrc
<span class="token function">vi</span> /etc/virc
<span class="token comment"># 在开头或者末尾添加</span>
<span class="token builtin class-name">set</span> number
</code></pre></div><h3 id="ssh会话执行文件"><a href="#ssh会话执行文件" class="header-anchor">#</a> SSH会话执行文件</h3> <ul><li><code>vi /etc/motd</code>这个文件，可以在里面加入自己喜欢的任何欢迎信息，这段信息将会在登录成功后显示！</li> <li><code>/etc/profile</code>中设定的变量(全局)的可以作用于任何用户,</li> <li><code>/.bashrc</code>设定的变量(局部)只能继承<code>/etc/profile</code>中的变量,他们是”父子”关系</li></ul> <blockquote><p>为每一个运行bash shell的用户执行此文件.当bash shell被打开时, 该文件被读取（即每次新开一个终端，都会执行bashrc）。</p> <p>只要在同一个shell界面，不管多少用户登录都只执行一次</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> /etc/profile
</code></pre></div><blockquote><p>此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从<code>/etc/profile.d</code>目录的配置文件中搜集shell的设置。</p> <p>如果进入shell用普通用户登录后，再用su进入root用户那么将会被执行两次</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> /etc/bashrc
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 当root用户登录时执行</span>
<span class="token function">vi</span> /root/.bash_profile
<span class="token comment"># 当每次root用户退出系统(退出bash shell)时,执行该文件</span>
<span class="token function">vi</span> /root/.bash_logout
<span class="token comment"># 当root用户登录时以及每次打开新的shell时,该该文件被读取。</span>
<span class="token function">vi</span> /root/.bashrc
</code></pre></div><h3 id="ssh欢迎信息"><a href="#ssh欢迎信息" class="header-anchor">#</a> ssh欢迎信息</h3> <ul><li><a href="https://github.com/taills/sysinfo" target="_blank" rel="noopener noreferrer">https://github.com/taills/sysinfo<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <blockquote><p>输入<kbd>shift</kbd> + <kbd>g</kbd>（就是大写的<code>G</code>）跳转到末尾添加以下内容</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token builtin class-name">echo</span> <span class="token string">'=========================================================='</span>
<span class="token comment"># 查看系统发行版信息</span>
<span class="token function">sed</span> -n -e <span class="token string">'s/PRETTY_NAME=//gp'</span> /etc/os-release
<span class="token comment"># 查询内核版本</span>
<span class="token function">cat</span> /proc/version
<span class="token builtin class-name">echo</span> <span class="token string">'=========================================================='</span>
<span class="token comment"># 查询目前所有文件系统的可用空间及使用情形</span>
<span class="token function">df</span> -h
<span class="token builtin class-name">echo</span> <span class="token string">'=========================================================='</span>
<span class="token comment"># 查询内存使用情况</span>
<span class="token function">free</span> -h
<span class="token builtin class-name">echo</span> <span class="token string">'=========================================================='</span>
<span class="token comment"># 切换到home文件夹</span>
<span class="token builtin class-name">cd</span> /home
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 查看系统发行版信息</span>
<span class="token function">cat</span> /etc/*release
<span class="token function">cat</span> /etc/os-release
<span class="token function">cat</span> /usr/lib/os-release
<span class="token comment"># 输出NAME和VERSION</span>
<span class="token builtin class-name">source</span> /etc/os-release <span class="token operator">&amp;&amp;</span> <span class="token builtin class-name">echo</span> <span class="token variable">$PRETTY_NAME</span>
<span class="token function">sed</span> -n -e <span class="token string">'s/PRETTY_NAME=//gp'</span> /etc/os-release
<span class="token function">cat</span> /etc/os-release <span class="token operator">|</span> <span class="token function">grep</span> ^PRETTY_NAME<span class="token operator">=</span> <span class="token operator">|</span> <span class="token function">awk</span> -F<span class="token operator">=</span> <span class="token string">'{print $2}'</span>
<span class="token comment"># 输出NAME部分</span>
<span class="token function">sed</span> -n -e <span class="token string">'/PRETTY_NAME/ s/^.*=\|&quot;\| .*//gp'</span> /etc/os-release
<span class="token function">cat</span> /etc/os-release <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&quot;PRETTY_NAME&quot;</span> <span class="token operator">|</span> <span class="token function">sed</span> <span class="token string">'s/PRETTY_NAME=//g'</span> <span class="token operator">|</span> <span class="token function">sed</span> <span class="token string">'s/[&quot;]//g'</span> <span class="token operator">|</span> <span class="token function">awk</span> <span class="token string">'{print $1}'</span>
<span class="token function">cat</span> /etc/issue
<span class="token function">cat</span> /etc/issue.net
<span class="token comment"># 查询内核版本</span>
<span class="token function">cat</span> /proc/version
<span class="token function">cat</span> /proc/sys/kernel/ostype /proc/sys/kernel/osrelease
<span class="token function">dmesg</span> <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">'Linux version'</span>
<span class="token function">uname</span> -sr
<span class="token comment"># 查看cpu相关信息（型号、主频、内核）</span>
<span class="token function">cat</span> /proc/cpuinfo
</code></pre></div><h2 id="开机启动"><a href="#开机启动" class="header-anchor">#</a> 开机启动</h2> <p><strong>添加命令到<code>/etc/rc.local</code>文件末尾</strong></p> <blockquote><p>编辑<code>/etc/rc.local</code>或者<code>/etc/rc.d/rc.local</code>（前者是后者的软连接）文件，
按<kbd>Shift</kbd> + <kbd>g</kbd>（就是大写的G）跳转到末尾添加运行命令</p> <blockquote><p>执行的程序需要写绝对路径，添加到系统环境变量的除外</p></blockquote></blockquote> <blockquote><p>为防止启动执行失败，最好执行一次<code>chmod +x /etc/rc.d/rc.local</code>进行授权</p></blockquote> <p><strong>crontab</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">crontab</span> -e
@reboot 运行程序命令
</code></pre></div><p><strong>脚本文件放在<code>/etc/profile.d/</code>目录下</strong></p> <ul><li><code>chkconfig</code></li></ul> <ol><li>创建软连接或者复制脚本到<code>/etc/init.d/</code>或者<code>/etc/rc.d/init.d/</code>（前者是后者的软连接）下</li></ol> <blockquote><p>注意脚本文件开头一定要添加以下几行代码，否侧会提示<code>chkconfig</code>不支持</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token shebang important">#!/bin/sh</span>
<span class="token comment"># - 64 36 分别代表运行级别，启动优先权，关闭优先权</span>
<span class="token comment"># chkconfig: - 64 36</span>
<span class="token comment"># description: Supervisor Server</span>
<span class="token comment"># processname: supervisord</span>
</code></pre></div><ol start="2"><li>添加启动项</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">chkconfig</span> --add 脚本名
<span class="token function">chkconfig</span> 脚本名 on
</code></pre></div><ol start="3"><li>检查是否设置成功</li></ol> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">chkconfig</span> --list <span class="token operator">|</span> <span class="token function">grep</span> 脚本名
</code></pre></div><h2 id="修改为root登录"><a href="#修改为root登录" class="header-anchor">#</a> 修改为root登录</h2> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 重置root密码，其他账户都一样按此方法修改root为指定账户即可</span>
<span class="token function">sudo</span> <span class="token function">passwd</span> root
<span class="token builtin class-name">echo</span> root:密码 <span class="token operator">|</span><span class="token function">sudo</span> chpasswd root
<span class="token comment"># 切换到root账号</span>
<span class="token function">su</span>
<span class="token function">sudo</span> -i
</code></pre></div><p><strong>修改sshd_config中的参数</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 编辑sshd_config文件</span>
<span class="token function">vi</span> /etc/ssh/sshd_config
</code></pre></div><ul><li><code>PermitRootLogin</code> 修改为<code>yes</code></li> <li><code>PasswordAuthentication</code> 修改为<code>yes</code></li></ul> <p><strong>或者执行命令直接修改</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># -r 支持扩展表达式，-i 直接修改文件内容</span>
<span class="token function">sudo</span> <span class="token function">sed</span> -i <span class="token string">'s/^#\?PermitRootLogin.*/PermitRootLogin yes/g'</span> /etc/ssh/sshd_config<span class="token punctuation">;</span>
<span class="token function">sudo</span> <span class="token function">sed</span> -ri <span class="token string">'s/^#?(PasswordAuthentication)\s+(yes|no)/\1 yes/'</span> /etc/ssh/sshd_config<span class="token punctuation">;</span>
<span class="token comment"># 修改authorized_keys文件（即ssh证书），把ssh-rsa之前的内容都删除掉</span>
<span class="token function">sudo</span> <span class="token function">sed</span> -ri <span class="token string">'s/^/#/;s/sleep 10&quot;\s+/&amp;\n/'</span> /root/.ssh/authorized_keys<span class="token punctuation">;</span>
</code></pre></div><p><strong>重启ssh</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">sudo</span> <span class="token function">service</span> sshd restart
</code></pre></div><h2 id="物理资源占用"><a href="#物理资源占用" class="header-anchor">#</a> 物理资源占用</h2> <blockquote><p>各Linux服务器主流发行版物理资源占用（磁盘和内存），<code>df -h &amp;&amp; free -h</code></p></blockquote> <ul><li>CentOS 7.6 64位</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        485M     <span class="token number">0</span>  485M   <span class="token number">0</span>% /dev
tmpfs           496M     <span class="token number">0</span>  496M   <span class="token number">0</span>% /dev/shm
tmpfs           496M  424K  496M   <span class="token number">1</span>% /run
tmpfs           496M     <span class="token number">0</span>  496M   <span class="token number">0</span>% /sys/fs/cgroup
/dev/vda1        50G  <span class="token number">1</span>.8G   46G   <span class="token number">4</span>% /
tmpfs           100M     <span class="token number">0</span>  100M   <span class="token number">0</span>% /run/user/0

              total        used        <span class="token function">free</span>      shared  buff/cache   available
Mem:           991M         68M        631M        428K        290M        787M
Swap:            0B          0B          0B
</code></pre></div><ul><li>Debian 9.0 64位</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>Filesystem      Size  Used Avail Use% Mounted on
udev            424M     <span class="token number">0</span>  424M   <span class="token number">0</span>% /dev
tmpfs            87M  <span class="token number">1</span>.8M   86M   <span class="token number">3</span>% /run
/dev/vda1        50G  923M   46G   <span class="token number">2</span>% /
tmpfs           435M     <span class="token number">0</span>  435M   <span class="token number">0</span>% /dev/shm
tmpfs           <span class="token number">5</span>.0M     <span class="token number">0</span>  <span class="token number">5</span>.0M   <span class="token number">0</span>% /run/lock
tmpfs           435M     <span class="token number">0</span>  435M   <span class="token number">0</span>% /sys/fs/cgroup
tmpfs            87M     <span class="token number">0</span>   87M   <span class="token number">0</span>% /run/user/0

              total        used        <span class="token function">free</span>      shared  buff/cache   available
Mem:           868M         32M        734M        <span class="token number">1</span>.8M        101M        717M
Swap:            0B          0B          0B
</code></pre></div><ul><li>Ubuntu Server 18.04.1 LTS 64位</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>Filesystem      Size  Used Avail Use% Mounted on
udev            462M     <span class="token number">0</span>  462M   <span class="token number">0</span>% /dev
tmpfs            99M  <span class="token number">5</span>.2M   94M   <span class="token number">6</span>% /run
/dev/vda1        50G  <span class="token number">2</span>.3G   45G   <span class="token number">5</span>% /
tmpfs           493M     <span class="token number">0</span>  493M   <span class="token number">0</span>% /dev/shm
tmpfs           <span class="token number">5</span>.0M     <span class="token number">0</span>  <span class="token number">5</span>.0M   <span class="token number">0</span>% /run/lock
tmpfs           493M     <span class="token number">0</span>  493M   <span class="token number">0</span>% /sys/fs/cgroup
tmpfs            99M     <span class="token number">0</span>   99M   <span class="token number">0</span>% /run/user/500

              total        used        <span class="token function">free</span>      shared  buff/cache   available
Mem:           985M         95M        355M        <span class="token number">5</span>.1M        533M        743M
Swap:            0B          0B          0B
</code></pre></div></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/woytu/notes-vuepress/edit/master//System/Linux配置.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2021-07-11 11:27:49</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/System/Linux操作.html" class="prev">
        Linux操作
      </a></span> <span class="next"><a href="/System/内网穿透.html">
        内网穿透
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.269009d6.js" defer></script><script src="/assets/js/3.974b9720.js" defer></script><script src="/assets/js/68.fa59daa9.js" defer></script>
  </body>
</html>
